package model

import (
	"time"
)

// 用户数据结构体定义
type User struct {
	ID        uint `gorm:"primary_key;AUTO_INCREMENT"`
	CreatedAt time.Time
	UpdatedAt time.Time
	//Id uint	`json:"id,omitempty"`
	Name   string `json:"name" gorm:"type:varchar(20)"`
	Passwd string `json:"passwd,omitempty" gorm:"type:varchar(20)"`
	Realname string `json:"realname" gorm:"type:varchar(20)"`
	Enable uint	`json:"enable,omitempty" gorm:"type:int(10)"`
	Cellphone  string `json:"cellphone,omitempty" gorm:"type:varchar(11)"`
	//CreateAt time.Time `json:"createAt,omitempty"`
	//UpdateAt time.Time `json:"updateAt,omitempty"`
	Role uint 	`json:"role,omitempty" gorm:"type:int(10)"`
	Department	uint	`json:"department,omitempty" gorm:"type:int(10)"`
}

// 角色表
type Role struct {
	ID        uint `gorm:"primary_key;AUTO_INCREMENT"`
	CreatedAt time.Time
	UpdatedAt time.Time
	//Id uint	`json:"id,omitempty"`
	Name   string `json:"name" gorm:"type:varchar(20)"`
	Intro string `json:"intro,omitempty" gorm:"type:varchar(20)"`
	MenuList string `json:"menu_list,omitempty" gorm:"type:varchar(200)"`
}

// 部门表
type Department struct {
	ID        uint `gorm:"primary_key;AUTO_INCREMENT"`
	CreatedAt time.Time
	UpdatedAt time.Time
	ParentId uint	`json:"parentId,omitempty" gorm:"type:int(10)"`
	Name   string `json:"name" gorm:"type:varchar(20)"`
	Leader string `json:"leader,omitempty" gorm:"type:varchar(20)"`
}

// 菜单表
type Menu struct {
	ID        uint `gorm:"primary_key;AUTO_INCREMENT"`
	CreatedAt time.Time
	UpdatedAt time.Time
	Name   string `json:"name" gorm:"type:varchar(20)"`
	Type uint	`json:"type,omitempty" gorm:"type:int(10)"`
	Icon   string `json:"icon" gorm:"type:varchar(30)"`
	Url   string `json:"url" gorm:"type:varchar(100)"`
	ParentId uint	`json:"parentId,omitempty" gorm:"type:int(10)"`
	Sort uint	`json:"sort,omitempty" gorm:"type:int(10)"`
	Permission string `json:"permission,omitempty" gorm:"type:varchar(100)"`
}

// 用来返回登陆信息，会携带token
type TokenUser struct {
	Id uint	`json:"id"`
	Name string	`json:"name"`
	Token string	`json:"token"`
}